<template>
  <div class="weText_editor">
    <!-- 加载编辑器的容器 -->
    <script :id="editorId" name="content" type="text/plain">
    </script>
    <el-form class="component_pos" label-width="70px">
      <el-form-item label="边框尺寸">
        <el-slider v-model="data.borderWidth" :max="50"></el-slider>
      </el-form-item>
      <el-form-item label="内边距">
        <el-slider v-model="data.padding" :max="100"></el-slider>
      </el-form-item>
      <el-form-item label="外边距">
        <el-slider v-model="data.margin" :max="100"></el-slider>
      </el-form-item>
      <el-form-item label="边框颜色">
        <el-color-picker v-model="data.borderColor"></el-color-picker>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
  import '@static/ueditor/ueditor.config'
  import '@static/ueditor/ueditor.all'
  import '@static/ueditor/lang/zh-cn/zh-cn'
  import ueditorMixin from '@/mixins/ueditorMixin'
  export default {
    props: {
      data: {
        type: Object,
        default: function () {
          return {
            content: '',
            borderWidth: 0,
            padding: 0,
            margin: 0,
            borderColor: '#666'
          }
        }
      }
    },
    mixins: [ueditorMixin],
    data () {
      return {
        editorId: 'editor' + Math.random().toString().slice(-4)
      }
    },
    mounted () {
      this.initUEditor()
    },
    watch: {
      content (val) {
        this.data.content = this.content
      }
    }
  }
</script>
<style lang="scss">
  .weText_editor{
    .edui-default .edui-toolbar{padding: 10px;}
    .component_pos{padding:10px 15px;}
    #edui30{border-bottom:0;padding-bottom:0;}
  }
</style>
